<template>  
  <div>  
    <button @click="increment">增加</button>  
    <p>{{ count }}</p>  
    <button @click="decrement">减少</button>  
  </div>  
</template>  
  
<script>  
export default {  
  data() {  
    return {  
      count: 0,  
    };  
  },  
  methods: {  
    increment() {  
      this.count++;  
    },  
    decrement() {  
      if (this.count > 0) {  
        this.count--;  
      }  
    },  
  },  
};  
</script>  
  
<style scoped>  
/* 样式可以在这里添加 */  
</style>